﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ZYO
{
    /// <summary>
    /// Interaction logic for UserControl六爻起卦.xaml
    /// </summary>
    public partial class UserControl六爻起卦 : UserControl
    {
        private class六爻起卦 p六爻起卦 = null;

        public UserControl六爻起卦()
        {
            InitializeComponent();

        }

        public class六爻起卦 六爻起卦
        {
            get { return p六爻起卦; }
            set
            {
                p六爻起卦 = value;

                label1.Content = p六爻起卦.theDate.Name;
                //if 用神不现， 3列
                this.listBox1.Items.Clear();
                for (int i = 5; i >= 0; i--)
                {
                     String item =String.Empty;

                     if (p六爻起卦.is用神不现)
                     {
                         if (p六爻起卦.用神.ID == i)
                         {
                             item += p六爻起卦.本卦.卦宫64.爻s[i].Name;
                         }
                         else
                         {
                             item += "               ";
                         }

                     }

                    item += " " + p六爻起卦.本卦.爻s[i].Name;

                    if (i == p六爻起卦.本卦.世爻.ID) //世爻
                    {
                        item += " 世 ";
                    }
                    else if (i == p六爻起卦.本卦.应爻.ID) //应爻)
                    {
                        item += " 应 ";

                    }
                    else
                    {
                        item += "    ";
                    }

                    if (p六爻起卦.本卦.爻s[i].is动)
                    {
                        item += "o ";
                        item += p六爻起卦.本卦.变卦.爻s[i].Name;
                    }

                    listBox1.Items.Add(item);
                }

            }
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

        }
    }
}
